<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            text-align: center;
            
        }
        .box .btn {
            margin: auto;
            width: 50px;
            height: 50px;
            line-height: 50px;
            background-color: #ddd;
            border-radius: 100%;
            color: #fff;
            cursor: pointer;
        }
   </style>
</head>
<body>
    <div class="box">
         <div class="btn">开</div>
         <img src="img/pic_bulboff.gif" alt="" class="img">
    </div>
    <script>
        (function(){
            var btn = document.querySelector('.btn');
            var img = document.querySelector('.img');
            btn.onclick = function(){
                console.log("this",this);
                if(this.innerHTML == "开"){
                    img.src = "img/pic_bulbon.gif"
                    this.innerHTML = "关"
                    btn.style.background = "green";
                }else{
                    img.src = "img/pic_bulboff.gif";
                    this.innerHTML = "开"
                    btn.style.background = "#ddd";
                }
            }
        }());
    </script>
</body>
</html>